package com.zbl.zblproject.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zbl.zblproject.erp.entity.ErpTempOrderItem;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;


/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/9
 * 供应商
 */
@TableName("zbl_suppliers")
public class Supplier implements Cloneable{

    @TableId(type = IdType.AUTO)
    private int suppliersId;

    private String suppliersName;

    private String suppliersDesc;

    private int isCheck;

    private String suppliersAddr;

    private String suppliersAccountInfo;

    private String contractPeriod;

    private String contractReturn;

    private String logisticsMode;

    private String factoryMake;

    private String spell;

    private String head;

    private String headNumber;

    private String orderDock;

    private String dockStation;

    private String purchaseDirector;

    private String purchaseDirectorNum;

    private String afterDesc;

    private String payWay;

    /**
     * 集中采购标识符
     *
     * 0:集中采购, 1:非集中采购
     * centralizedPurchasing
     */
    private int centralizedPurchasing;

    /**
     * 启用状态
     * 0:启用 1:缺少暂停付款 2:暂停订货  3:暂停退货 4:禁用
     */
    private int status;

    /**
     * 区域
     */
    private String area;

    /**
     * 负责人职位
     */
    private String principalPosition;

    /**
     * 直发标识
     */
    private int straightIden;

    /**
     * 供应天数
     */
    private int supplyDay;

    private String dockStationTel;

    /**
     * 省份ID
     */
    private int provinceId;

    /**
     * 市ID
     */
    private int cityId;

    /**
     * 区ID
     */
    private int areaId;

    /**
     * 返点率
     */
    private BigDecimal rebateRate;

    /**
     * 余额
     */
    private BigDecimal balance;

    /**
     * erp商品
     */
    @TableField(exist = false)
    private List<ErpTempOrderItem> items = new ArrayList<>();


    public int getSuppliersId() {
        return suppliersId;
    }

    public void setSuppliersId(int suppliersId) {
        this.suppliersId = suppliersId;
    }

    public String getSuppliersName() {
        return suppliersName;
    }

    public void setSuppliersName(String suppliersName) {
        this.suppliersName = suppliersName;
    }

    public String getSuppliersDesc() {
        return suppliersDesc;
    }

    public void setSuppliersDesc(String suppliersDesc) {
        this.suppliersDesc = suppliersDesc;
    }

    public int getIsCheck() {
        return isCheck;
    }

    public void setIsCheck(int isCheck) {
        this.isCheck = isCheck;
    }

    public String getSuppliersAddr() {
        return suppliersAddr;
    }

    public void setSuppliersAddr(String suppliersAddr) {
        this.suppliersAddr = suppliersAddr;
    }

    public String getSuppliersAccountInfo() {
        return suppliersAccountInfo;
    }

    public void setSuppliersAccountInfo(String suppliersAccountInfo) {
        this.suppliersAccountInfo = suppliersAccountInfo;
    }

    public String getContractPeriod() {
        return contractPeriod;
    }

    public void setContractPeriod(String contractPeriod) {
        this.contractPeriod = contractPeriod;
    }


    public String getLogisticsMode() {
        return logisticsMode;
    }

    public void setLogisticsMode(String logisticsMode) {
        this.logisticsMode = logisticsMode;
    }

    public String getFactoryMake() {
        return factoryMake;
    }

    public void setFactoryMake(String factoryMake) {
        this.factoryMake = factoryMake;
    }

    public String getSpell() {
        return spell;
    }

    public void setSpell(String spell) {
        this.spell = spell;
    }

    public String getHead() {
        return head;
    }

    public void setHead(String head) {
        this.head = head;
    }

    public String getHeadNumber() {
        return headNumber;
    }

    public void setHeadNumber(String headNumber) {
        this.headNumber = headNumber;
    }

    public String getOrderDock() {
        return orderDock;
    }

    public void setOrderDock(String orderDock) {
        this.orderDock = orderDock;
    }

    public String getDockStation() {
        return dockStation;
    }

    public void setDockStation(String dockStation) {
        this.dockStation = dockStation;
    }

    public String getPurchaseDirector() {
        return purchaseDirector;
    }

    public void setPurchaseDirector(String purchaseDirector) {
        this.purchaseDirector = purchaseDirector;
    }

    public String getPurchaseDirectorNum() {
        return purchaseDirectorNum;
    }

    public void setPurchaseDirectorNum(String purchaseDirectorNum) {
        this.purchaseDirectorNum = purchaseDirectorNum;
    }

    public String getAfterDesc() {
        return afterDesc;
    }

    public void setAfterDesc(String afterDesc) {
        this.afterDesc = afterDesc;
    }

    public String getPayWay() {
        return payWay;
    }

    public void setPayWay(String payWay) {
        this.payWay = payWay;
    }

    public String getContractReturn() {
        return contractReturn;
    }

    public void setContractReturn(String contractReturn) {
        this.contractReturn = contractReturn;
    }


    public int getCentralizedPurchasing() {
        return centralizedPurchasing;
    }

    public void setCentralizedPurchasing(int centralizedPurchasing) {
        this.centralizedPurchasing = centralizedPurchasing;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getPrincipalPosition() {
        return principalPosition;
    }

    public void setPrincipalPosition(String principalPosition) {
        this.principalPosition = principalPosition;
    }

    public int getStraightIden() {
        return straightIden;
    }

    public void setStraightIden(int straightIden) {
        this.straightIden = straightIden;
    }

    public String getDockStationTel() {
        return dockStationTel;
    }

    public void setDockStationTel(String dockStationTel) {
        this.dockStationTel = dockStationTel;
    }


    public int getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(int provinceId) {
        this.provinceId = provinceId;
    }

    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public int getAreaId() {
        return areaId;
    }

    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }

    public List<ErpTempOrderItem> getItems() {
        return items;
    }

    public void setItems(List<ErpTempOrderItem> items) {
        this.items = items;
    }


    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public Supplier cloneNew(){
        try {
            return (Supplier) clone();
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }

    public ErpTempOrderItem getOneItem(ErpTempOrderItem item){
        if(items != null && items.contains(item)){
            return items.get(items.indexOf(item));
        }
        return null;
    }



    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Supplier supplier = (Supplier) o;
        return suppliersId == supplier.suppliersId;
    }

    public int getSupplyDay() {
        return supplyDay;
    }

    public void setSupplyDay(int supplyDay) {
        this.supplyDay = supplyDay;
    }

    @Override
    public int hashCode() {
        return Objects.hash(suppliersId);
    }


    public BigDecimal getRebateRate() {
        return rebateRate;
    }

    public void setRebateRate(BigDecimal rebateRate) {
        this.rebateRate = rebateRate;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "Supplier{" +
                "suppliersId=" + suppliersId +
                ", suppliersName='" + suppliersName + '\'' +
                ", suppliersDesc='" + suppliersDesc + '\'' +
                ", isCheck=" + isCheck +
                '}';
    }
}
